﻿using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
using Expo.Training.DataAccess.Activity;
using LitJson;

/// <summary>
///ActivityService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。 
[System.Web.Script.Services.ScriptService]
public class ActivityService : System.Web.Services.WebService
{

    public ActivityService()
    {

        //如果使用设计的组件，请取消注释以下行 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }

    #region 获取报名详细信息
    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public string GetRegistrationDetails(string id)
    {
        try
        {
            ActivityRegistrationDetailsEntity _model = new ActivityRegistrationDetailsEntity();
            _model = ActivityModule.GetRegistration(new Guid(id));
            JsonRegistrationDetailsEntity _jsonObject = JsonRegistrationDetailsEntity.Parse(_model);
            return JsonMapper.ToJson(_jsonObject);

        }
        catch (Exception ex)
        {
            throw ex;
        }

    }
    #endregion


}

